package eu.tanov.epf.pv.types.project.ui.pages;

import org.eclipse.epf.uma.CustomCategory;
import org.eclipse.ui.forms.editor.FormEditor;

import edu.fmi.st.epf.types.team.common.util.TeamHelper;
import eu.tanov.epf.pv.service.types.handler.CustomTypeHandler;
import eu.tanov.epf.pv.service.types.service.CustomTypeHandlersService;
import eu.tanov.epf.pv.types.project.common.util.ProjectHelper;
import eu.tanov.epf.pv.types.project.ui.ProjectActivator;
import eu.tanov.epf.pv.types.project.ui.provider.ProjectItemProvider;
import eu.tanov.epf.pv.ui.common.pages.AbstractCustomTypeCategoryPage;
import eu.tanov.epf.pv.ui.common.util.EditorHelper;

public class ProjectTeamsPage extends
		AbstractCustomTypeCategoryPage<CustomCategory> {
	private static final String FORM_PAGE_ID = "projectTeamsPage"; //$NON-NLS-1$	

	public ProjectTeamsPage(FormEditor editor) {
		super(editor, FORM_PAGE_ID, "Teams", getTypeHelper(), "Teams");
		EditorHelper.updateTitleImage(editor,
				ProjectItemProvider.getProjectImage());
	}

	private static CustomTypeHandler<CustomCategory> getTypeHelper() {
		final CustomTypeHandlersService service = ProjectActivator.getDefault()
				.getService(CustomTypeHandlersService.class);
		return service.getHandlerForType(TeamHelper.getCustomType(),
				CustomCategory.class);
	}

	@Override
	protected String tabString() {
		return "Teams";
	}

	@Override
	protected String multipleSelectDescription(int count) {
		return count + "Teams have been selected";
	}

	@Override
	protected String sectionDescription() {
		return "Manage the Teams that belong to this Project.";
	}

	@Override
	protected String sectionName() {
		return "Teams";
	}

	@Override
	protected String selectedLabel() {
		return "Teams";
	}

	@Override
	protected String[] modelStructurePath() {
		return ProjectHelper.PROJECTS_PATH;
	}
}
